home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 March
/
CMCD0305.ISO
/
Software
/
Shareware
/
Utilitare
/
emu
/
Emu8086_Setup_307c.exe
/
{app}
/
Samples
/
scasw.asm
< prev
next >
Wrap
Assembly Source File
|
2002-08-02
|
748b
|
57 lines
; This sample shows how
; to use SCASW instruction
; to find a WORD (2 bytes).
#make_COM#
; COM file is loaded at 100h
; prefix:
ORG 100h
; set forward direction:
CLD
; set counter to data size:
MOV CX, 4
; load string address
; into ES:DI
MOV AX, CS
MOV ES, AX
LEA DI, dat1
; we will look for the 9012h
; word in data string:
MOV AX, 9012h
REPNE SCASW
JZ found
not_found:
; "No" - not found!
MOV AL, 'N'
MOV AH, 0Eh
INT 10h
JMP exit_here
found:
; "Yes" - found!
MOV AL, 'Y'
MOV AH, 0Eh
INT 10h
; DI contains the
; offset of 9012h word:
DEC DI
exit_here:
RET
dat1 DW 1234h, 5678h, 9012h, 3456h
END